#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT(webloggr, 1.0, puninj@cs.rpi.edu)
AC_CONFIG_SRCDIR([src/WLOGR_frame.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE

# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB

AC_ARG_WITH(graphpack,
	AC_HELP_STRING([--with-graphpack=<path>],[prefix of graphpack header directory]),
	[GRAPHPACK=$with_graphpack],
	[GRAPHPACK=`pwd`/graphpack-1.0/src])
	AC_SUBST(GRAPHPACK)

AC_ARG_WITH(weblog,
	AC_HELP_STRING([--with-weblog=<path>].[prefix of weblog header directory]),
	[WEBLOG=$with_weblog],
	[WEBLOG=`pwd`/webloglib-1.0/src])
	AC_SUBST(WEBLOG)

AC_ARG_WITH(htmlrep,
	AC_HELP_STRING([--with-htmlrep=<path>],[prefix of htmlrep header directory]),
	[HTMLREP=$with_htmlrep],
	[HTMLREP=`pwd`/htmlreplib-1.0/src])
	AC_SUBST(HTMLREP)

AC_ARG_WITH(xmlrep,
	AC_HELP_STRING([--with-xmlrep=<path>],[prefix of xmlrep header directory]),
	[XMLREP=$with_xmlrep],
	[XMLREP=`pwd`/xmlreplib-1.0/src])
	AC_SUBST(XMLREP)

AC_ARG_WITH(libwww,
	AC_HELP_STRING([--with-w3c-libwww=<path>],[prefix of w3c's www library directory]),
	[W3C_WWW=$with_libwww],
	[W3C_WWW=/usr/include/w3c-libwww])
	AC_SUBST(W3C_WWW)


AC_CHECK_LIB([graphpack], [main])
AC_CHECK_LIB([htmlrep], [main])
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([nsl], [main])
AC_CHECK_LIB([rx], [main])
AC_CHECK_LIB([socket], [main])
AC_CHECK_LIB([webgraphlogs], [main])
AC_CHECK_LIB([weblog], [main])
AC_CHECK_LIB([wwwcore], [main])
AC_CHECK_LIB([wwwdir], [main])
AC_CHECK_LIB([wwwfile], [main])
AC_CHECK_LIB([wwwhtml], [main])
AC_CHECK_LIB([wwwtrans], [main])
AC_CHECK_LIB([wwwutils], [main])
AC_CHECK_LIB([xmlparse], [main])
AC_CHECK_LIB([xmlrep], [main])
AC_CHECK_LIB([xmltok], [main])
AC_CHECK_LIB([z], [main])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM

# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([alarm getcwd gethostbyaddr gethostbyname inet_ntoa memset pow sqrt strcasecmp strchr strncasecmp strrchr strstr strtol])

AC_CONFIG_FILES([Makefile
                 graphpack-1.0/Makefile
                 graphpack-1.0/src/Makefile
                 htmlreplib-1.0/Makefile
                 htmlreplib-1.0/src/Makefile
                 src/Makefile
                 webloglib-1.0/Makefile
                 webloglib-1.0/src/Makefile
                 xmlreplib-1.0/Makefile
                 xmlreplib-1.0/src/Makefile])
AC_OUTPUT
